var input = document.querySelectorAll('input');
var btn = document.querySelector('.btn');
btn.onclick = function() {
    var obj = {
        clazz: input[0].value,
        name: input[1].value,
        gender: input[2].value,
        age: input[3].value,
        hobby: input[4].value,
        remark: input[5].value,
        address: input[6].value,
        tel: input[7].value,
        date: input[8].value
    }
    var xhr = new XMLHttpRequest();
    xhr.open('post', 'http://192.168.20.50:3008/api/student/addStudent');
    xhr.setRequestHeader('Content-type', 'application/json');
    xhr.send(JSON.stringify(obj));
    xhr.onreadystatechange = function() {
        if (xhr.readyState == 4) {
            console.log(xhr.responseText);
        }
    }
}